var express = require('express');
var router = express.Router();
var sign =require('./sign.js');


exports.appList = function(req,res){

    sign.delEmptyValue(req.body); 
    sign.dataReq(req,req.body,req.session.apikey,'/sysmanage/app/list',"POST",function(ResData){
        if(ResData!=""){
            res.json(ResData);
        }
    });
}

exports.appGet = function(req,res){
	sign.dataReq(req,req.body,req.session.apikey,'/sysmanage/app/getApp',"POST",function(ResData){
        if(ResData!=""){
        	res.json(ResData);
        }
    });
}

exports.appEdit = function(req,res){
   
    sign.delEmptyValue(req.body); 
    sign.dataReq(req,req.body,req.session.apikey,'/sysmanage/app/edit',"POST",function(ResData){
        if(ResData!=""){
        	res.json(ResData);
        }
    });
}

exports.appDel = function(req,res){
    if(req.body.id){
        var data={'ids':[req.body.id]}
    }else if(req.body['id[]'].constructor == String){
        var data={'ids':[req.body['id[]']]}
    }else{
        var data={'ids':req.body['id[]']}
    }
	sign.dataReq(req,data,req.session.apikey,'/sysmanage/app/del',"POST",function(ResData){
        if(ResData!=""){
        	res.json(ResData);
        }
    });
}

exports.testAddress=function(req,res){

    sign.dataReq(req,req.body,req.session.apikey,'/sysmanage/app/testAddress',"POST",function(ResData){
        if(ResData!=""){
            res.json(ResData);
        }
    });
}
